package com.zbowen.invoice.web.demo;

import com.zbowen.invoice.repository.po.ComGdsvType;
import com.zbowen.invoice.tax.dto.ComGdsvTypeDto;
import com.zbowen.invoice.tax.service.ComGdsvTypeService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.LinkedList;
import java.util.List;

@Slf4j
@RestController
@RequestMapping("/com_gdsv_type")
public class ComGdsvTypeController {

    @Autowired
    private ComGdsvTypeService comGdsvTypeService;

    @GetMapping("/query/list")
    public List<ComGdsvTypeDto> queryPage() throws Exception {
        List<ComGdsvType> list = comGdsvTypeService.list();
        List<ComGdsvTypeDto> target = new LinkedList<>();
        for (ComGdsvType comGdsvType : list) {
            ComGdsvTypeDto comGdsvTypeVo = new ComGdsvTypeDto();
            BeanUtils.copyProperties(comGdsvTypeVo, comGdsvType);
            target.add(comGdsvTypeVo);
        }
        return target;
    }
}
